﻿// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using TODOLIST.assets;

#nullable disable

namespace TODOLIST.Migrations
{
    [DbContext(typeof(TableContext))]
    partial class TableContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.4")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

            modelBuilder.Entity("TODOLIST.Models.Person", b =>
                {
                    b.Property<int>("id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("id"));

                    b.Property<string>("PasswordHash")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("name")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("id");

                    b.ToTable("Persons");
                });

            modelBuilder.Entity("TODOLIST.Models.Request", b =>
                {
                    b.Property<int>("id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("id"));

                    b.Property<int>("PersonId")
                        .HasColumnType("int");

                    b.Property<int>("RequestDataId")
                        .HasColumnType("int");

                    b.HasKey("id");

                    b.HasIndex("PersonId");

                    b.HasIndex("RequestDataId");

                    b.ToTable("Requests");
                });

            modelBuilder.Entity("TODOLIST.Models.RequestData", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<DateTime>("AddData")
                        .HasColumnType("datetime2");

                    b.Property<DateTime>("ChangeData")
                        .HasColumnType("datetime2");

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int?>("Personid")
                        .HasColumnType("int");

                    b.Property<int>("StatusId")
                        .HasColumnType("int");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("Id");

                    b.HasIndex("Personid");

                    b.ToTable("RequestDatas");
                });

            modelBuilder.Entity("TODOLIST.Models.Request", b =>
                {
                    b.HasOne("TODOLIST.Models.Person", "Person")
                        .WithMany()
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("TODOLIST.Models.RequestData", "RequestData")
                        .WithMany()
                        .HasForeignKey("RequestDataId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Person");

                    b.Navigation("RequestData");
                });

            modelBuilder.Entity("TODOLIST.Models.RequestData", b =>
                {
                    b.HasOne("TODOLIST.Models.Person", null)
                        .WithMany("PersonRequests")
                        .HasForeignKey("Personid");
                });

            modelBuilder.Entity("TODOLIST.Models.Person", b =>
                {
                    b.Navigation("PersonRequests");
                });
#pragma warning restore 612, 618
        }
    }
}
